//
//  PersonCenter.m
//  YYPHSpeedJump
//
//  Created by sujiang on 15/12/21.
//  Copyright © 2015年 sujiang. All rights reserved.
//

#import "PersonCenter.h"
#import "MineHomeCell.h"

@interface PersonCenter ()<UITableViewDelegate, UITableViewDataSource>



@end

@implementation PersonCenter

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addSubViews];
    self.view.backgroundColor = kColors(239, 239, 244, 1);
    [self.tableView registerNib:[UINib nibWithNibName:@"MineHomeCell" bundle:nil] forCellReuseIdentifier:@"MineHomeCell"];

}

- (NSMutableArray *)dataArray
{
    if (!_dataArray) {
        _dataArray = [NSMutableArray arrayWithObjects:@"头像", @"用户名", @"昵称", @"性别", @"出生日期", @"地址管理", @"修改密码", nil];
    }
    return _dataArray;
}

- (void)addSubViews
{
    self.navigationItem.title = @"个人中心";
    self.tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:(UITableViewStyleGrouped)];
    [self.view addSubview:self.tableView];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArray.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0 && indexPath.row == 0) {
        
        return 57;
    }
    return 34;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0 && indexPath.row == 0) {
        MineHomeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MineHomeCell" forIndexPath:indexPath];
        return cell;
    }
    static NSString *str = @"PersonCenter";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleSubtitle) reuseIdentifier:str];
        cell.textLabel.font = [UIFont systemFontOfSize:12];
    }
    cell.textLabel.text = self.dataArray[indexPath.row];
    if (indexPath.section == 0 && indexPath.row == 0) {
        cell.imageView.image = [UIImage imageNamed:@"微博二维码"];        
    }
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 8;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
